package com.javase.data.structure.stack.array;

/**
 * 栈应用：字符串倒序输出(业务实现)
 *
 * @author wangsh
 * @date 2018/11/18 17:33.
 */
public class StackArrayApply {
    String input;

    public StackArrayApply(String input) {
        this.input = input;
    }

    public String doReverse() {
        StackArray s = new StackArray(input.length());
        for (int i = 0; i < input.length(); i++) {
            s.push(input.charAt(i));
        }
        String output = "";
        while (!s.isEmpty()) {
            output += s.pop();
        }
        return output;
    }
}
